<?php

/**
 * Stations form base class.
 *
 * @method Stations getObject() Returns the current form's model object
 *
 * @package    TMD
 * @subpackage form
 * @author     Thaihosting
 */
abstract class BaseStationsForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'ISTATION_ID'              => new sfWidgetFormInputHidden(),
      'IWMO_STATION_NUMBER'      => new sfWidgetFormInputText(),
      'SSTATION_NAME_ENG'        => new sfWidgetFormInputText(),
      'SSTATION_NAME_THAI'       => new sfWidgetFormInputText(),
      'SCHEIF_USER_NAME'         => new sfWidgetFormInputText(),
      'SADDRESS_NUMBER'          => new sfWidgetFormInputText(),
      'SVILLAGE'                 => new sfWidgetFormInputText(),
      'SDISTRICT'                => new sfWidgetFormInputText(),
      'SREGION'                  => new sfWidgetFormInputText(),
      'SPROVINCE'                => new sfWidgetFormInputText(),
      'SPOSTAL_CODE'             => new sfWidgetFormInputText(),
      'ILATITUDE_DEGREE'         => new sfWidgetFormInputText(),
      'ILATITUDE_MINUTE'         => new sfWidgetFormInputText(),
      'ILATITUDE_SECOND'         => new sfWidgetFormInputText(),
      'ILONGITUDE_DEGREE'        => new sfWidgetFormInputText(),
      'ILONGITUDE_MINUTE'        => new sfWidgetFormInputText(),
      'ILONGITUDE_SECOND'        => new sfWidgetFormInputText(),
      'DSTATION_HEIGHT'          => new sfWidgetFormInputText(),
      'DBAROMETER_HEIGHT'        => new sfWidgetFormInputText(),
      'DTHERMOMETER_HEIGHT'      => new sfWidgetFormInputText(),
      'DWINDARROW_HEIGHT'        => new sfWidgetFormInputText(),
      'DWINDMETER_HEIGHT'        => new sfWidgetFormInputText(),
      'DRAINGAUGE_HEIGHT'        => new sfWidgetFormInputText(),
      'BTHOURLY_SYNOP'           => new sfWidgetFormInputCheckbox(),
      'BT3HOUR_SYNOP'            => new sfWidgetFormInputCheckbox(),
      'BTDAILY_SYNOP'            => new sfWidgetFormInputCheckbox(),
      'IGEOGRAPHIC_REGION'       => new sfWidgetFormInputText(),
      'DTSAVE_TIME'              => new sfWidgetFormDateTime(),
      'BTSUB_STATION_RAIN'       => new sfWidgetFormInputCheckbox(),
      'BTHYDRO'                  => new sfWidgetFormInputCheckbox(),
      'BTAGRO'                   => new sfWidgetFormInputCheckbox(),
      'BTACTIVE'                 => new sfWidgetFormInputCheckbox(),
      'SPHONE_NUMBER'            => new sfWidgetFormInputText(),
      'ITIME_REPORT_PRESSURE'    => new sfWidgetFormInputText(),
      'BTREPORT_SEA_STATE'       => new sfWidgetFormInputCheckbox(),
      'BTREPORT_HOURLY'          => new sfWidgetFormInputCheckbox(),
      'BTREPORT_3HOUR'           => new sfWidgetFormInputCheckbox(),
      'BTREPORT_DAILY'           => new sfWidgetFormInputCheckbox(),
      'BTREPORT_WATER_LEVEL'     => new sfWidgetFormInputCheckbox(),
      'BTREPORT_MICRO_CLIMATE'   => new sfWidgetFormInputCheckbox(),
      'BTREPORT_SUBSTATION_RAIN' => new sfWidgetFormInputCheckbox(),
      'ISTATION_TYPE'            => new sfWidgetFormInputText(),
      'BTREPORT_SEA_VISIBILITY'  => new sfWidgetFormInputCheckbox(),
      'DTCREATE_TIME'            => new sfWidgetFormDateTime(),
      'SCONTACT_NAME'            => new sfWidgetFormInputText(),
      'ITIME_REPORT_3HOUR'       => new sfWidgetFormInputText(),
      'IUSER_ID'                 => new sfWidgetFormInputText(),
      'BTREPORT_CLIMAT'          => new sfWidgetFormInputCheckbox(),
      'BTREPORT_UPPERAIR'        => new sfWidgetFormInputCheckbox(),
    ));

    $this->setValidators(array(
      'ISTATION_ID'              => new sfValidatorChoice(array('choices' => array($this->getObject()->getIstationId()), 'empty_value' => $this->getObject()->getIstationId(), 'required' => false)),
      'IWMO_STATION_NUMBER'      => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'SSTATION_NAME_ENG'        => new sfValidatorString(array('max_length' => 200, 'required' => false)),
      'SSTATION_NAME_THAI'       => new sfValidatorString(array('max_length' => 200, 'required' => false)),
      'SCHEIF_USER_NAME'         => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'SADDRESS_NUMBER'          => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'SVILLAGE'                 => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'SDISTRICT'                => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'SREGION'                  => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'SPROVINCE'                => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'SPOSTAL_CODE'             => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'ILATITUDE_DEGREE'         => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'ILATITUDE_MINUTE'         => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'ILATITUDE_SECOND'         => new sfValidatorNumber(array('required' => false)),
      'ILONGITUDE_DEGREE'        => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'ILONGITUDE_MINUTE'        => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'ILONGITUDE_SECOND'        => new sfValidatorNumber(array('required' => false)),
      'DSTATION_HEIGHT'          => new sfValidatorNumber(array('required' => false)),
      'DBAROMETER_HEIGHT'        => new sfValidatorNumber(array('required' => false)),
      'DTHERMOMETER_HEIGHT'      => new sfValidatorNumber(array('required' => false)),
      'DWINDARROW_HEIGHT'        => new sfValidatorNumber(array('required' => false)),
      'DWINDMETER_HEIGHT'        => new sfValidatorNumber(array('required' => false)),
      'DRAINGAUGE_HEIGHT'        => new sfValidatorNumber(array('required' => false)),
      'BTHOURLY_SYNOP'           => new sfValidatorBoolean(array('required' => false)),
      'BT3HOUR_SYNOP'            => new sfValidatorBoolean(array('required' => false)),
      'BTDAILY_SYNOP'            => new sfValidatorBoolean(array('required' => false)),
      'IGEOGRAPHIC_REGION'       => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'DTSAVE_TIME'              => new sfValidatorDateTime(array('required' => false)),
      'BTSUB_STATION_RAIN'       => new sfValidatorBoolean(array('required' => false)),
      'BTHYDRO'                  => new sfValidatorBoolean(array('required' => false)),
      'BTAGRO'                   => new sfValidatorBoolean(array('required' => false)),
      'BTACTIVE'                 => new sfValidatorBoolean(array('required' => false)),
      'SPHONE_NUMBER'            => new sfValidatorString(array('max_length' => 9, 'required' => false)),
      'ITIME_REPORT_PRESSURE'    => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'BTREPORT_SEA_STATE'       => new sfValidatorBoolean(array('required' => false)),
      'BTREPORT_HOURLY'          => new sfValidatorBoolean(array('required' => false)),
      'BTREPORT_3HOUR'           => new sfValidatorBoolean(array('required' => false)),
      'BTREPORT_DAILY'           => new sfValidatorBoolean(array('required' => false)),
      'BTREPORT_WATER_LEVEL'     => new sfValidatorBoolean(array('required' => false)),
      'BTREPORT_MICRO_CLIMATE'   => new sfValidatorBoolean(array('required' => false)),
      'BTREPORT_SUBSTATION_RAIN' => new sfValidatorBoolean(array('required' => false)),
      'ISTATION_TYPE'            => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'BTREPORT_SEA_VISIBILITY'  => new sfValidatorBoolean(array('required' => false)),
      'DTCREATE_TIME'            => new sfValidatorDateTime(array('required' => false)),
      'SCONTACT_NAME'            => new sfValidatorString(array('max_length' => 200, 'required' => false)),
      'ITIME_REPORT_3HOUR'       => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'IUSER_ID'                 => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'BTREPORT_CLIMAT'          => new sfValidatorBoolean(array('required' => false)),
      'BTREPORT_UPPERAIR'        => new sfValidatorBoolean(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('stations[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Stations';
  }


}
